import React from 'react' //臭宝
import './login.less'
import Log from './log'
import Register from './register'
import { Route, Switch, Redirect } from 'react-router-dom'
import { Tabs } from 'antd'
import { Provider } from 'react-redux'
import store from '../../store/index'
const { TabPane } = Tabs;
export default class Login extends React.Component {
    state = {
        keys: "/login/log"
    }
    render() {
        return (
            <Provider store={store}>
                <div className="Login" style={{ backgroundImage: "url(" + require("../../img/Login_Tu.jpeg").default + ")" }}>
                    <div className="Login_iconback" onClick={()=>{this.back()}}><span className="iconfont icon-fanhui2"></span></div>
                    <div className={"Login_Biu"}>带&nbsp;给&nbsp;你&nbsp;不&nbsp;一&nbsp;样&nbsp;的&nbsp;体&nbsp;验</div>
                    <div className="Login_Center">
                        {/* <Switch>
                        <Redirect from="/login" to="/login/log" exact></Redirect>
                    </Switch> */}
                        <Tabs className={"tabsStyle"}
                          activeKey={this.state.keys}  defaultActiveKey={"/login/log"} centered tabBarGutter={55} size="default" onChange={(e) => { this.ke(e) }}>
                            <TabPane tab="登录" key="/login/log" >
                                {/* <Switch>
                                <Route path="/login/log" component={Log} >
                                </Route>
                            </Switch> */}
                            <div>
                            <Log {...this}></Log>
                            </div>
                                
                            </TabPane>
                            <TabPane tab="注册" key="/login/register" >
                                {/* <Switch>
                                <Route path="/login/register" component={Register}>
                                </Route>
                            </Switch> */}
                            <div>
                            <Register {...this}></Register>
                            </div>
                                
                            </TabPane>
                        </Tabs>
                    </div>
                </div>
            </Provider>
        )
    }
    ke = (key) => {
        // this.props.history.push(key)
        console.log(key);
        this.setState({ keys: key },()=>{
            console.log(this.state.keys);
        })
    }
    back=()=>{
        this.props.history.go(-1)
    }
    TansTwo = (e) => {
        console.log(e);
    }
    componentDidMount() {
        console.log(this.props.location.pathname);
    }
}